package com.esms.struts.service;

import java.util.List;

import com.esms.bean.*;

public class FinancialRateService {
	private FinancialRateService() {}
	public static FinancialRateService $ = new FinancialRateService(); 
	
	private static Enterprisefinancialrate enterpriseFinancialRate;
	
	public double getEndowmentRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 22 : enterpriseFinancialRate.getEndowmentRateC();
	}
	
	public double getMedicalRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 12 : enterpriseFinancialRate.getMedicalRateC();
	}
	
	public double getSuspensionRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 2 : enterpriseFinancialRate.getSuspensionRateC();
	}
	
	public double getWorkplaceRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 0.5 : enterpriseFinancialRate.getWorkplaceRateC();
	}
	
	public double getMaterntiyRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 0.5 : enterpriseFinancialRate.getMaternityRateC();
	}
	
	public double getEndowmentRATE_E(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 8 : enterpriseFinancialRate.getEndowmentRateE();
	}
	
	public double getMedicalRATE_E(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 2 : enterpriseFinancialRate.getMedicalRateE();
	}
	
	public double getSuspensionRATE_E(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 1 : enterpriseFinancialRate.getSuspensionRateE();
	}
	
	public double getHousingfundRATE_C(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 7 : enterpriseFinancialRate.getHousingfundRateC();
	}
	
	public double getHousingfundRATE_E(String enterpriseId) {
		List list = EnterprisefinancialrateDAO.$.findByFfenterpriseId(enterpriseId);
		if(list.isEmpty())
			enterpriseFinancialRate = null;
		else 
			enterpriseFinancialRate = (Enterprisefinancialrate) list.get(0);
		//default value
		return (null == enterpriseFinancialRate) ? 7 : enterpriseFinancialRate.getHousingfundRateE();
	}
}
